﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable hashtable = new Hashtable();

            Hashtable ht = new Hashtable();
            ht.Add(1, "语文");
            ht.Add(2, "数学");
            ht.Add(3, "英语");

            Console.WriteLine("请输入课程编号");
            int id = int.Parse(Console.ReadLine());

            if (ht.ContainsKey(id))
            {
                Console.WriteLine("你选修了该课程");
            }
            else
            {
                Console.WriteLine("抱歉，没有找到");
            }

            Console.WriteLine("输出所以课程信息：");
            foreach (DictionaryEntry d in ht)
            {
                int key = (int)d.Key;
                string value = d.Value.ToString();
                Console.WriteLine("课程编号：{0}，课程名称：{1}", key, value);
            }
        }
    }
}
